package com.hecn.demo02;

/**
 * 代理角色：增加日志的实现
 *
 * @author 24497
 */
public class UserServiceProxy implements UserService {
  private UserServiceImpl userService;

  public void setUserService(UserServiceImpl userService) {
    this.userService = userService;
  }

  /** add */
  public void add() {
    log("add");
    userService.add();
  }

  /** delete */
  public void delete() {
    log("delete");
    userService.delete();
  }

  /** update */
  public void update() {
    log("update");
    userService.update();
  }

  /** select */
  public void select() {
    log("query");
    userService.select();
  }

  public void log(String msg) {
    System.out.println("执行了" + msg + "方法");
  }
}
